<template>
  <div class="activity-detail-container">
    <div class="activity-content">
      <div class="activity-illustration">
        <img src="@/assets/images/activeImg.png" alt="全球合作插图" />
      </div>
      <div class="right">
        <div class="right1">
          <div class="title">{{ item.resName }}</div>
          <div class="info">
            {{ item.remark }}
          </div>
          <div class="line">
            <div class="info-row">
              <span class="info-label">出版社名称:</span>
              <span class="info-value">{{ item.publisher }}</span>
            </div>

            <div class="info-row">
              <span class="info-label">时间：</span>
              <span class="info-value">{{ transformDate(item.uploadTime, "local", "YYYY-MM-DD") }}</span>
            </div>
          </div>
        </div>
        <div class="right2">
          <div class="icon"><img src="/src/assets/images/zan.png" alt="" />{{ item.starNum }}</div>
          <div class="icon"><img src="/src/assets/images/view.png" alt="" />{{ item.watchNum }}</div>
          <div class="icon"><img src="/src/assets/images/xz.png" alt="" />{{ item.downloadNum }}</div>
        </div>
      </div>
      <div v-if="props.type == 1" class="btn">
        <span>在线阅读</span>
      </div>
      <el-tag v-if="props.type == 2" :type="typesTag[item.type]">{{ types[item.type] }}</el-tag>
    </div>
    <el-divider />
  </div>
</template>

<script setup>
import { ref, defineProps } from "vue";
import { transformDate } from "@/utils";
const types = {
  1: "音视频",
  2: "课程包",
  3: "数字教材"
};
const typesTag = {
  1: "primary",
  2: "warning",
  3: "success"
};
const props = defineProps({
  type: {
    type: Number,
    default: 1
  },
  item: {
    type: Object,
    default: () => {
      return {};
    }
  }
});
// 可以在这里添加组件逻辑
// 例如：报名功能、数据获取等
</script>

<style lang="scss" scoped>
.activity-detail-container {
  position: relative;
  box-sizing: border-box;
  width: 1550px;
  height: 240px;
  padding: 20px;
  margin: 0 auto;
  margin-bottom: 20px;
  color: #333333;
  cursor: pointer;
  &:hover {
    background-color: #e9f3ff;
  }

  // background-color: white;
}
.activity-tag {
  padding: 4px 12px;
  margin-left: 20px;
  font-size: 14px;
  color: white;
  background-color: #409eff;
  border-radius: 4px;
}
.right {
  display: flex;
  flex-grow: 1;
  .right1 {
    .title {
      margin-bottom: 11px;
      font-size: 18px;
      font-weight: 700;
      color: #1981ff;
    }
    .info {
      width: 952px;
      margin-bottom: 98px;
      font-size: 14px;
      color: #3963a6;
    }
    .line {
      display: flex;
      gap: 40px;
      width: 100%;
      font-size: 14px;
      color: #3963a6;
    }
  }
  .right2 {
    display: flex;
    flex-grow: 1;
    align-items: flex-end;
    justify-content: flex-end;
    .icon {
      margin-right: 26px;
      img {
        margin-right: 10px;
      }
    }
  }
}
.activity-content {
  display: flex;
  .activity-illustration {
    position: relative;
    width: 240px;
    height: 200px;
    margin-right: 30px;
    overflow: hidden;
    border-radius: 20px;
    img {
      width: 100%;
      height: auto;
    }
    span {
      position: absolute;
      top: 0;
      left: 0;
      display: block;
      width: 80px;
      height: 36px;
      line-height: 36px;
      color: white;
      text-align: center;
      background-color: #486570;
      border-radius: 0 0 20px;
    }
  }
  .btn {
    position: absolute;
    top: 56px;
    right: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 124px;
    height: 40px;
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    background-color: #1881ff;
    border: 1px solid #99bfff;
    border-radius: 4px;
  }
  .tag {
    position: absolute;
    top: 20px;
    right: 35px;
  }
}
</style>
